package com.laery0.xixin.controller;

import com.laery0.xixin.po.ResponseBean;
import com.laery0.xixin.po.Users;
import com.laery0.xixin.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/users")
public class UsersController {
    @Autowired
	private UsersService usersService;

    @PostMapping("/login")
	public ResponseBean<Users> getUsersByUserIdByPass(@RequestBody Users users) {
		return usersService.getUsersByUserIdByPass(users);
	}

    @PostMapping("/search")
	public ResponseBean<Users> getUsersById(@RequestBody Users users) {
		return usersService.getUsersById(users.getUserId());
	}

    @PostMapping("/register")
	public ResponseBean<Integer> saveUsers(@RequestBody Users users) {
		return usersService.saveUsers(users);
	}
}
